/**
 * 自定义js V1.0
 */
$(function () {
    $('.screen-full').click(function () {
        if ($(this).hasClass('layui-icon-screen-full')) {
            $(this).removeClass('layui-icon-screen-full');
            $(this).addClass('layui-icon-screen-restore');
            fullScreen();
        } else {
            $(this).removeClass('layui-icon-screen-restore');
            $(this).addClass('layui-icon-screen-full');
            exitFullScreen();
        }

    });

    /*进入全屏*/
    function fullScreen() {
        var el = document.documentElement;
        var rfs = el.requestFullScreen || el.webkitRequestFullScreen ||
            el.mozRequestFullScreen || el.msRequestFullScreen;
        if (typeof rfs != "undefined" && rfs) {
            rfs.call(el);
        } else if (typeof window.ActiveXObject != "undefined") {
            //for IE，这里其实就是模拟了按下键盘的F11，使浏览器全屏
            var wscript = new ActiveXObject("WScript.Shell");
            if (wscript != null) {
                wscript.SendKeys("{F11}");
            }
        }
    }

    /*退出全屏*/
    function exitFullScreen() {
        var el = document;
        var cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.exitFullScreen;
        if (typeof cfs != "undefined" && cfs) {
            cfs.call(el);
        } else if (typeof window.ActiveXObject != "undefined") {
            var wscript = new ActiveXObject("WScript.Shell");
            if (wscript != null) {
                wscript.SendKeys("{F11}");
            }
        } else if (el.msExitFullscreen) {
            el.msExitFullscreen();
        } else if (el.oRequestFullscreen) {
            el.oCancelFullScreen();
        }
    }

});